package com.hzeport.bgs22emduty.inbound.api;

import com.hzeport.bgs22emduty.config.login.LoginCompoentService;
import com.hzeport.bgs22emduty.config.login.UserInfoDetailVO;
import com.hzeport.bgs22emduty.config.systemLog.OperLog;
import com.hzeport.bgs22emduty.dto.ScreenEmergencyPlanDTO;
import com.hzeport.bgs22emduty.dto.ScreenStandardControllerDTO;
import com.hzeport.bgs22emduty.entity.ScreenStandard;
import com.hzeport.bgs22emduty.vo.ScreenEmergencyPlan.ScreenEmergencyPlanSaveVO;
import com.hzeport.bgs22emduty.vo.ScreenEmergencyPlan.ScreenPlanSortVO;
import com.hzeport.bgs22emduty.vo.ScreenStandard.ScreenStandSortVO;
import com.hzeport.bgs22emduty.vo.ScreenStandard.ScreenStandardsaveVO;
import com.hzeport.bgs22emduty.common.base.BaseResult;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzeport.bgs22emduty.entity.ScreenEmergencyPlan;
import com.hzeport.bgs22emduty.service.ScreenEmergencyPlanService;
//import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * ${comments}
 *
 * @author code generator
 * @date 2023-02-14 09:39:44
 */
@RestController
@AllArgsConstructor
@RequestMapping("/screenemergencyplan")
@Api(value = "screenemergencyplan", tags = "应急预案管理")
@Slf4j
public class ScreenEmergencyPlanController {

    private final ScreenEmergencyPlanService screenEmergencyPlanService;
    @Resource
    private LoginCompoentService loginCompoentService;

    @ApiOperation(value = "列表")
    @RequestMapping(value = "list",method = RequestMethod.POST)
    public  BaseResult<Page<ScreenEmergencyPlan>> list(@RequestBody ScreenEmergencyPlanDTO dto) {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return  screenEmergencyPlanService.list(dto,userInfoDetailVO);
    }

    @ApiOperation(value = "删除")
    @RequestMapping(value = "delete",method = RequestMethod.POST)
    @OperLog( systemName = "YJYA", description = "YJSC")
    public BaseResult removeById(@RequestParam("id") String id) {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return screenEmergencyPlanService.delete(id,userInfoDetailVO);
    }

    @ApiOperation(value = "保存")
    @RequestMapping(value = "save",method = RequestMethod.POST)
    @OperLog( systemName = "YJYA", description = "YJBC")
    public BaseResult save(@RequestBody ScreenEmergencyPlanSaveVO screenStandardsaveVO) throws Exception {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return  screenEmergencyPlanService.saveData(screenStandardsaveVO,userInfoDetailVO);
    }
    @ApiOperation(value = "获取详情")
    @RequestMapping(value = "detail",method = RequestMethod.GET)
    public BaseResult<ScreenEmergencyPlanSaveVO> detail(@RequestParam("id") String id){
        return screenEmergencyPlanService.detail(id);
    }


    @ApiOperation(value = "序号排序")
    @RequestMapping(value = "saveSort",method = RequestMethod.POST)
    @OperLog( systemName = "YJYA", description = "YJPX")
    public BaseResult updatesort(@RequestBody ScreenPlanSortVO screenPlanSortVO)  {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return screenEmergencyPlanService.saveSort(screenPlanSortVO,userInfoDetailVO);
    }

}
